{% extends "indoors.html" %}
{% load humanize %}

{% block title %}
{{phone_number}}
{% if is_self %}(Me){% endif %}
{% endblock title %}

{% block head %}
<style>
.ui-li-desc {
  white-space: normal;
}
</style>
{% endblock head %}

{% block content %}
<h2>Updates</h2>
<span id="message"></span>
<ul data-role="listview" data-inset="true">
  {% for review in reviews %}
    <li data-role="list-divider">
      {% if review.user.get_profile.number == phone_number %}
        Owner
      {% elif review.user == user %}
        {{review.poster_number_display}} - Me
      {% else %}
        {{review.poster_number_display}}
      {% endif %}
      <p class="ui-li-count">{{review.date|naturaltime}}</p>
    </li>
    <li class="review_item {% if review.user == user %}review_owner{% endif %}" id="review-{{review.pk}}">
    <a href="/a/review/{{review.pk}}">
      <p class="ui-li-desc">{{review.text}}</p>
      <p class="ui-li-count" id="votes">{{review.votes}}</p>
    </a>
    </li>
  {% empty %}
    <li data-role="list-divider">No reviews. Be the first to review</li>
  {% endfor %}
  {% if reviews %}
    <li data-role="list-divider">
      Write a review
    </li>
  {% endif %}
  <li>
  <form action='/a/{{phone_number.number}}' method="POST">{% csrf_token %}
    <textarea style="width:100%" name="new_review"></textarea>
    <input style="text-align:right;" type='submit' value="submit">
  </form>
  </li>
</ul>
{% endblock %}